import java.io.ByteArrayOutputStream
import java.io.File

fun main() {
//    val bytes = File("xx.txt").inputStream().use { it.readBytes() }

    val bytes = File("xx.txt").inputStream().use {
        val buffer = ByteArrayOutputStream(maxOf(DEFAULT_BUFFER_SIZE, it.available()))
        it.copyTo(buffer)
        buffer.toByteArray()
    }
    println(String(bytes))


}